body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: sans-serif;
  user-select: none;
}

#sidebar {
  width: 100%;
  background: #f5f5f5;
  border-right: 1px solid #ddd;
  padding: 10px;
  overflow-y: auto;
}

#sidebar h3 {
  margin-top: 0;
  font-weight: normal;
  font-size: 18px;
  text-align: center;
}

#sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#sidebar ul li {
  padding: 10px;
  margin: 5px 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sidebar ul li.selected {
  background-color: #4caf50;
  color: white;
  border-color: #4caf50;
  font-weight: bold;
}

#container {
  border: 2px dashed #ff0000;
  overflow: hidden;
  background-size: cover;
  transform-origin: 0 0; /* 左上角 */
}

.draggable {
  position: absolute;
  font-size: 16px;
  padding: 5px 10px;
  cursor: default;
  user-select: none;
  transition: border-color 0.3s;
  min-width: 40px;
  box-sizing: border-box;
  overflow: hidden;
}

.draggable.active {
  border: 1px solid #4caf50;
  border-radius: 6px;
  cursor: grab;
}

.draggable img {
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
  user-select: none;
}

/* 右边缘调节条 */
.resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 100%;
  cursor: ew-resize;
  background: rgba(76, 175, 80, 0.3);
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  user-select: none;
  z-index: 10;
}

.button-row {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  z-index: 1000;
  flex-wrap: wrap;
}

button {
  padding: 10px 18px;
  font-size: 16px;
  border-radius: 6px;
  border: none;
  background-color: #4caf50;
  color: white;
  cursor: pointer;
  user-select: none;
}

button:active {
  background-color: #388e3c;
}

/* 隐藏文件输入 */
#fileInput {
  display: none;
}